<?php 

function step2()
{
$max_upload = (int)(ini_get('upload_max_filesize'));
$max_post = (int)(ini_get('post_max_size'));
$memory_limit = (int)(ini_get('memory_limit'));
$upload_mb = min($max_upload, $max_post, $memory_limit);

  if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['pre_error'] =='')
{
   header('Location: index.php?step=3');
   exit;
  }
  if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['pre_error'] != '')
   echo $_POST['pre_error'];
echo "<a href='index.php?step=3'>Click here to override this check and continue (not recommended)</a>";

  if (phpversion() < '5.3.0') {
   $pre_error = 'PHP 5.3.0 or above is required for AudioShout to work properly, but you are running version '. phpversion() . '. Please upgrade to at least PHP 5.3.0 and then run this installer again.  <br />';
  }
  if (!ini_get('file_uploads')) {
   $pre_error .= 'AudioShout requires file upload support to be enabled in your PHP environment. To enable them, edit your php.ini file and set the "file_uploads"" directive to "On".<br />';
  }
  if (ini_get('register_globals')) {
   $pre_error .= 'AudioShout cannot be installed while the register globals setting is enabled. To disable it, edit your php.ini file and comment out the "register_globals" line.<br />';
  }
  if (ini_get('safe_mode')) {
   $pre_error .= 'AudioShout cannot be installed while Safe Mode is enabled. To disable it, edit your php.ini file and comment out the "safe_mode" line.<br />';
  }
  if ($upload_mb <= 5) {
   $pre_error .= "The maximum allowed size for file uploads must be at least 5 MB. Please edit your php.ini file and set the 'upload_max_filesize' value to at least 5M.<br />";
  }
  if (!extension_loaded('curl')) {
   $pre_error .= 'Support for Curl was not found on your server. Please make sure that Curl is installed and that its PHP extension has been loaded.<br />';
  }
if (!extension_loaded('fileinfo')) {
   $pre_error .= 'The "fileinfo" extension was not found in your PHP environment. Please make sure this extension has been loaded before continuing.<br />';
  }
  if (!extension_loaded('gd')) {
   $pre_error .= 'Support for the GD graphics library was not found on your server. Please make sure the GD extension is loaded and then try again.<br />';
  }
if (!extension_loaded('mysql')) {
   $pre_error .= 'Support for MySQL was not found on your server. Please make sure that MySQL 5.5 is installed and thhat its PHP extension has been loaded. If you are running a version of MySQL older than 5.5 (e.g. 5.0 or 5.1), please upgrade to at least 5.5.0 before continuing.<br />';
  }
if (!extension_loaded('mysqli')) {
   $pre_error .= 'Support for MySQLi was not found on your server. Please make sure this extension has been loaded into your PHP environment and then try again.<br />';
  }

  if (!is_writable('../inc/settings.php')) {
   $pre_error .= 'The "settings.php" in the "inc" folder needs to be writable before you can install AudioShout. This is because all of the program\'s configuration settings are saved to this file. Please make sure the file exists and that its permissions are at least 755 and then try again.';
  }
require("step2.tpl");
}
  ?>

